package com.cykj.controller;

import com.cykj.dto.ResponseDto;
import com.cykj.service.RoleService;
import com.cykj.vo.RoleMenuVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @BeLongsProject: psychologically
 * @BeLongsPackage: com.cykj.controller
 * @Author: 小李
 * @Date: 2025/2/6 00:27
 * @Description: 角色控制层
 * @Version: 1.0
 */
@RestController
@RequestMapping("role")
public class RoleController {

    @Autowired
    private RoleService roleService;

    //获取所有角色
    @GetMapping("getAllRole")
    public ResponseDto getAllRole() {
        return roleService.getAllRole();
    }

    //获取角色已分配菜单
    @RequestMapping("getRoleMenu")
    public ResponseDto getRoleMenu(Integer roleId) {
        return roleService.getRoleMenu(roleId);
    }

    //修改菜单
    @RequestMapping("updateRoleMenu")
    public ResponseDto updateRoleMenu(@RequestBody RoleMenuVo vo) {
        return roleService.updateRoleMenu(vo);
    }
}
